﻿using System;
using System.Collections.Generic;
using System.Text;

using System.IO;
using System.Reflection;

using System.Windows.Forms;

using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace ContentLoading
{


    public enum ProcessorContent
    {
        VideoProcessor,
        TextureProcessor,
        ModelProcessor
    }

    public class ContentProperties
    { 
        public string pathfile;
        public string name; 
        public string importer;
        public ProcessorContent processor;

        public ContentProperties()
        {

        }

        public ContentProperties(string pathfile,string name ,string importer ,ProcessorContent processor)
        {
            this.pathfile = pathfile;
            this.name = name;
            this.importer = importer;
            this.processor = processor;
        }
    }

    public class ControlContentBuilder
    {
        ContentBuilder contentBuilder;
        public ContentManager contentManager;
        ContentProperties contentproperties;
 
        public ControlContentBuilder(IServiceProvider inputservice,bool isCreateTemp ,string BuildPath, string pathProject)
        {
            contentBuilder = new ContentBuilder(isCreateTemp, BuildPath, pathProject);

            contentManager = new ContentManager(inputservice, contentBuilder.OutputDirectory);
        }

        public void Settingpath(string inputpath)
        {
            contentBuilder.SettingPathBuild(inputpath);
            contentManager.RootDirectory = contentBuilder.OutputDirectory;
        }

        public void SettingProprety(ContentProperties inputcontentproperties)
        {
            contentproperties = inputcontentproperties;
        }

        public string ContentBuilding()
        {
            if (contentBuilder != null)
            {
                contentBuilder.Clear();
                contentBuilder.Add(contentproperties.pathfile, contentproperties.name, contentproperties.importer, contentproperties.processor.ToString());
                return contentBuilder.Build();
            }
            else return "ContentBuilder = null";
        }

        public void CleanSource()
        {
            
            // Requet Massage Return succeed
            Directory.Delete(contentBuilder.BuildDirectory, true);
        }

       
    }
}
